FROM ubuntu:22.04

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y ca-certificates && \
    rm -rf /var/lib/apt/lists/* && \
    sed -i 's|http://.*archive.ubuntu.com|https://mirrors.aliyun.com|g' /etc/apt/sources.list && \
    sed -i 's|http://.*security.ubuntu.com|https://mirrors.aliyun.com|g' /etc/apt/sources.list && \
    apt-get update

RUN apt-get update && apt-get install -y \
    software-properties-common curl &&\
    #add-apt-repository ppa:deadsnakes/ppa -y && \
    rm -rf /var/lib/apt/lists/*


# 安装Python 3.10
RUN apt-get update && \
    apt-get install -y python3.10 python3.10-distutils python3-pip && \
    ln -s /usr/bin/python3.10 /usr/local/bin/python3  && \
    rm -rf /var/lib/apt/lists/*

# 安装python 扩展包
RUN pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple && \
  pip3 config set global.trusted-host pypi.tuna.tsinghua.edu.cn && \
  pip3 install  \
    fastmcp==2.6.0 \
    pandas==2.3.0 \
    numpy==2.2.6 \
    openpyxl==3.1.5  \
    xlrd==2.0.1  \
    fastapi==0.115.12

# 安装supervisor
RUN apt-get update && apt-get install -y supervisor && \
    rm -rf /var/lib/apt/lists/*

# 创建工作目录
RUN mkdir -p /app
WORKDIR /app

ADD etc /etc
ADD ./code /app

# 创建日志目录（Supervisor需要）
RUN mkdir -p /var/log/supervisor && \
    mkdir -p /var/run/supervisor

EXPOSE 8000

# 容器启动命令
CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisord.conf"]
